package com.kukudexin.controller;

import com.alibaba.fastjson.JSONObject;
import com.kukudexin.service.FileOpenofficeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * @author: 酷酷的鑫
 * @Date: 2021/11/9 14:40
 * @description:
 */
@RestController
@RequestMapping("/api/file")
public class FileOpenofficeController {
    @Autowired
    private FileOpenofficeService fileOpenofficeService;

    private static final String url = "D:\\a.doc";

    @GetMapping("/onlinePreview")
    public void onlinePreview(HttpServletResponse response) throws Exception{
        JSONObject jsonObject = JSONObject.parseObject(url);
        String filePath = (String) jsonObject.get("url");
        fileOpenofficeService.onlinePreview(filePath,response);
    }
}
